public class TestDemo3 {

    public static void main(String[]args){
        long start = System.currentTimeMillis();


        String s="";
        for(int i=0;i<10000;i++)
        {
            s+=i;

        }
        long end=System.currentTimeMillis();
        System.out.println("String:"+(end-start));
        StringBuffer buffer=new StringBuffer("");
        start=System.currentTimeMillis();
        for(int i=0;i<10000;i++)
        {
     buffer.append(i);

        }
        end=System.currentTimeMillis();
        System.out.println("StringBuffer:"+(end-start));
        StringBuilder builder=new StringBuilder("");
        start=System.currentTimeMillis();
        for(int i=0;i<10000;i++)
        {
            builder.append(i);

        }
        end=System.currentTimeMillis();
        System.out.println("StringBuilder:"+(end-start));
        s=new String(builder);






    }
}
